import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入需要的组件
import Login from '@/components/MyLogin.vue'
import Home from '@/components/MyHome.vue'
import Identity from '@/components/MySelectIdentity.vue'
import SignIn from '@/components/MySignIn.vue'

import MapHomePage from '@/components/share/MapHomePage.vue'
import VoluntaryStatistics from '@/components/share/VoluntaryStatistics.vue'
import MyVoluntary from '@/components/voluntary/MyVoluntary.vue'
import VoluntaryDetail from '@/components/share/VoluntaryDetail.vue'
import ActivityComment from '@/components/voluntary/ActivityComment.vue'
import MyOrganizationVoluntary from '@/components/organization/MyOrganizationVoluntary.vue'
import CreateActivity from '@/components/organization/CreateActivity.vue'
import ManagerVoluntary from '@/components/organization/ManagementVoluntary.vue'
import OrganizationVoluntary from '@/components/organization/MyActivityVoluntary.vue'


//管理者
import AllVoluntary from '@/components/manager/AllVoluntary.vue'
import AllOrganization from '@/components/manager/AllOrganization.vue'
import AllaActivity from '@/components/manager/AllaActivity.vue'
import ActivityVoluntary from '@/components/manager/ActivityVoluntary.vue'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/', redirect: '/SelectIdentity' },
    //选择身份路由规则
    {
      path: '/SelectIdentity',
      component: Identity,
    },
    //志愿者登录路由
    {
      path: '/SelectIdentity/Voluntary/Login',
      component: Login
    },
    //志愿者注册路由
    {
      path: '/SelectIdentity/Voluntary/SignIn',
      component: SignIn
    },
    //组织人员登录路由
    {
      path: '/SelectIdentity/Organization/Login',
      component: Login
    },
    //组织人员注册路由
    {
      path: '/SelectIdentity/Organization/SignIn',
      component: SignIn
    },
    //管理人员登录路由
    {
      path: '/SelectIdentity/Manager/Login',
      component: Login
    },
    // 后台主页的路由规则
    {
      path: '/home',
      component: Home,
      redirect: '/home/MapHomePage',
      children: [
        //志愿者路由
        { path: 'MapHomePage', component: MapHomePage },
        { path: 'VoluntaryStatistics', component: VoluntaryStatistics },
        { path: 'MyVoluntary', component: MyVoluntary },
        { path: 'MyVoluntary/Show/:id', component: VoluntaryDetail },
        { path: '/home/MyVoluntary/Comment/:id', component: ActivityComment },
        //组织人员路由
        { path: 'MyOrganizationVoluntary', component: MyOrganizationVoluntary },
        { path: 'MyOrganizationVoluntary/Show/:id', component: VoluntaryDetail },
        { path: 'CreateActivity', component: CreateActivity },
        { path: 'MyOrganizationVoluntary/Manager/:id', component: ManagerVoluntary },
        { path: 'MyOrganizationVoluntary/Voluntary/:id', component: OrganizationVoluntary },
        //管理者
        { path: 'AllVoluntary', component: AllVoluntary },        
        { path: 'AllOrganization', component: AllOrganization },
        { path: 'AllaActivity', component: AllaActivity },
        { path: 'AllActivity/Voluntary/:id', component: ActivityVoluntary },
      ]
    }
  ]
})

export default router
